<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>礼品规则管理</title>
<script language="javascript" src="../script/common.js"
	type="text/javascript"></script>
<script language="javascript" type="text/javascript"> 	
		var data = parent.persongl;
		//全局变量
		var org = Common.cOrg();		//当前单位
		var qt = {};				//数据表格对象
		var qtNew = {};				//数据表格对象
		var qt3 = {};	
		 var qt2 = {};
		 var qtrun={};
		 var qtlist = {};
		var b;
	     var istop=0;		//数据表格对象
		var oper=Common.cOperator();
		
		//初始化下拉框
		function load(){
		    Eui.showNavigation(); 	
		   $("viewdate").orgw.value=org.id;
		    $("checkform").orgidcheck.value=org.id;
		   $("detviewsave").orgw.value=org.id;
		    DWR.call('giftProjectService.isEdit',function(v){
		            if(v){
		               $("viewdate").bin.disabled=false;
		            }else{
		               $("viewdate").bin.disabled=true;
		               $("detviewsave").ee.disabled=true;
		              
		            }
		            b=v;
		    });
		      DWR.call("giftStorageService.getLocationAllParents",function(v){	
		  	$("runfrom").orgid.value=v;
		  	});
		      $("listview").style.display="";
		   //  Common.initDict(crelistform.accLevel, "customer_level", "请选择");
			//Common.initDict(pcardform.accLevel1, "customer_level", "请选择");
			//Common.initDict(updateform.accLevel, "customer_level", "请选择");
		   // Common.initDict("acclevel","customer_level","全 部");
			setPages(["listview","detviewsavelist","detview","detviewupdate","detviewupdate2","listview2","listview9","group_all","runpaviwe"]);
			createTable();
		}
		//初始化下拉框
	    //限制文本域输入字数
	    function textCounter(field, countfield, maxlimit) {
        if (field.value.length > maxlimit) 
           field.value = field.value.substring(0,maxlimit);
        else 
          countfield.value = maxlimit - field.value.length;
        }
		//生成表格，创建QueryTable对象   
		function createTableNew(){
			var columns =[];
				columns[6]={title:"操 作",width:"6%",align:"center",render:newRuleList,order:false}
				columns[7]={title:"删 除",width:"6%",align:"center",render:deleteNewRule,order:false}
			qtNew = new QueryTable("loy_rule_list_new","detviewsave","datalist3",columns);
		}
		function newRuleList(v,r){
		if(r[9]==1){
		   if(r[3]=="规则停用"){
			return "<a href=# onclick=\><font color=\"gray\">停用审请</font></a>"
		      }
		    else{
		       return	"<a href=# onclick=\"updateRule('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"','"+r[7]+"');return false;\">修改</a>"
		    } 
		}else{
		   if(r[3]=="规则停用"){
			   return "<a href=# onclick=\><font color=\"gray\">停用审请</font></a>"
		       }
		       else{
		       return "<a href=# onclick=\><font color=\"gray\">修改</font></a>"
		      } 
		
		  }
		}
		function Cancl(){
		switchPage('group_all');
			$("listview").style.display="";
			     createTable();
				showData();switchPage("listview");
		}
			function Cancl2(){
			showData5();
		    switchPage("listview2");
		
		}
		function updateRule(name,point,acc,stat,end,com,giftruleid){
		  var  obj=document.getElementsByName("customers2"); 
              getAccByCH(acc,obj);
		      updateform.giftname.value=name;
		      updateform.points.value=point;
		      //updateform.accLevel.value=acc;
		      updateform.startDate.value=stat;
		      updateform.endDate.value=end;
		      if(com=="null"){
		           updateform.comments.value="";
		      }else{
		           updateform.comments.value=com;
		      }
		 
		      updateform.giftruleid.value=giftruleid;
		     
			switchPage('detviewupdate2');
		}
		function deleteNewRule(v,r){
		  if(r[9]==1){
		       if(r[3]=="规则停用"){
		          return	"<a href=# onclick=\"deRule('"+r[3]+"','"+r[7]+"');return false;\">取消停用</a>"
		             }else{
		              return	"<a href=# onclick=\"deRule('"+r[3]+"','"+r[7]+"');return false;\">删除</a>"
		             }
		        
		   }else{
		     if(r[3]=="规则停用"){
		          return "<a href=# onclick=\><font color=\"gray\">取消停用</font></a>"
		             }else{
		              return "<a href=# onclick=\><font color=\"gray\">删除</font></a>"
		             }
		       
		   }
		
		}
		function deRule(type,id){
               DWR.call('giftProjectService.deleteGiftRule',type,id,function(v){
                  showInformation("取消申请规则成功!");
				createTableNew();
				showDataNew();
				switchPage('detviewsavelist');
                });
		}
		function createTable(){
			var columns =[];
			     columns[5]={title:"操 作",width:"6%",align:"center",render:updateFunc,order:false}
				columns[6]={title:"操 作",width:"6%",align:"center",render:qiyongFunc,order:false}
				columns[7]={title:"查看历史规则",width:"12%",align:"center",render:viewHis,order:false}
			qt = new QueryTable("loy_rule_list","viewdate","datalist",columns);
		}
	     function updateFunc(v,r){
	       if(!b){
		return "<a href=# onclick=\><font color=\"gray\">修改</font></a>"
		}else{
		  return "<a href=# onclick=\"updateF('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"','"+r[8]+"');return false;\">修改</a>"
		}
	       
	     }
	     function updateF(name,point,acc,stat,end,com,ruleid,giftid){
	  
	 
           DWR.call('giftProjectService.isStop',ruleid,function(v){
			if(v){
			 showError("已经存在修改申请了");
                  }else{  
                   var  obj=document.getElementsByName("customers3"); 
                     getAccByCH(acc,obj);
              
             
	           $("pcardform").giftname.value=name;
		       $("pcardform").points.value=point;
		       //$("pcardform").accLevel1.value=acc;
		       $("pcardform").startDate.value=stat;
		       $("pcardform").endDate.value=end;
		       if(com=="null"){
		          $("pcardform").comments.value=""; 
		       }else{
		       $("pcardform").comments.value=com; 
		       }
		       $("pcardform").comments.value=com; 
		       $("pcardform").ruleid.value=ruleid;
		       $("pcardform").giftid.value=giftid;
	    	    	 switchPage('detviewupdate'); 
	    	    	 }});
	     }
	     function getAccByCH(acc,obj){
	        var accs=acc.split("|");
	       var checkacc=[];
	        for(var i=0;i<accs.length-1;i++){
	            if(accs[i]=="普通卡"){
	             checkacc[i]=1;
	            }else if(accs[i]=="银卡"){
	             checkacc[i]=2;
	            }
	            else if(accs[i]=="金卡"){
	             checkacc[i]=3;
	            }
	            else if(accs[i]=="钻石卡"){
	             checkacc[i]=4;
	            }
	            
	        }
	       for(var j=0;j<checkacc.length;j++){
                  for (var i=0;i <obj.length;i++) 
                    {
                       if(checkacc[j]==obj[i].value){
                       obj[i].checked=true; 
                       }
                     }
               }
	     }
	     function onUpate(){
	            var  obj=document.getElementsByName("customers3");
	         var  aa; 
	       var str1="";
          for (var i=0;i <obj.length;i++) 
        { 
                var e   = obj[i]; 
            if(e.id== "customers3") 
              { 
                 if(e.checked   ==   true)   
                  {     
                       aa=obj[i].value; 
                       str1+=aa+","; 
                       } 
             } 
}

     if(str1!=""){
              var str=str1.substring(0,str1.length-1)
		      var point=$("pcardform").points.value;
		    //  var acc=$("pcardform").accLevel1.value;
		      var stat=$("pcardform").startDate.value;
		      var end=$("pcardform").endDate.value;
		      var com=$("pcardform").comments.value; 
		      var ruleids=$("pcardform").ruleid.value;
		      var giftids=$("pcardform").giftid.value;
		      if(comptime(stat,end)!=1){
			    showInformation("规则开始日期必须小于规则结束日期!");
			    return;
			}	
	      	DWR.call('giftProjectService.updateGiftRule',giftids,point,str,com,stat,end,ruleids,function(v){
		      	createTableNew();
				showDataNew();
				switchPage('detviewsavelist');
		      	});
		      	}else{
		      	      showInformation("请选择客户级别!");
		      	}
	     }
	     function onUpdateMo(){
	       var  obj=document.getElementsByName("customers2");
	         var  aa; 
	       var str1="";
          for (var i=0;i <obj.length;i++) 
        { 
                var e   = obj[i]; 
            if(e.id== "customers2") 
              { 
                 if(e.checked   ==   true)   
                  {     
                       aa=obj[i].value; 
                       str1+=aa+","; 
                       } 
             } 
          }
        if(str1!=""){
            var str=str1.substring(0,str1.length-1)
              var point=updateform.points.value;
		     // var acc=updateform.accLevel.value;
		      var com=updateform.comments.value;
		      var giftruleid=updateform.giftruleid.value;
	           var beginTime=updateform.startDate.value;
			 var endTime=updateform.endDate.value;
			if(comptime(beginTime,endTime)!=1){
			    showInformation("规则开始日期必须小于规则结束日期!");
			    return;
			}
		
			if(!checkForm(updateform))return;
				if(showQuestion("您确认保存?")==false){
				return;
			}	
			DWR.call('giftProjectService.updateGiftRuleAMD',point,str,com,beginTime,endTime,giftruleid,function(v){
		      	createTableNew();
				showDataNew();
				switchPage('detviewsavelist');
		      	});
			
            }else{
                  showInformation("请选择客户级别!");
            }
	         
	     }
		//发送审核申请   
		function qiyongFunc(v,r){//处理数据 点公司名称进入编辑页面
		if(!b){
		return "<a href=# onclick=\><font color=\"gray\">停用</font></a>"
		}else{
		  return "<a href=# onclick=\"onStop('"+r[6]+"');return false;\">停用</a>"
		}
			
		}
		function onStop(ruleid){
			DWR.call('giftProjectService.isStop',ruleid,function(v){
			if(v){
			 showError("已经申请停用");
                  }else{                                                                                                                                                                                                                                                                                                                                                              
			DWR.call('giftProjectService.stopGiftRule',ruleid,function(v){
			     istop=1;
		      	createTableNew();  
				showDataNew();
				switchPage('detviewsavelist');
		      	});
			}
			});
		
			
		} 
		function viewHis(v,r){
		 return "<a href=# onclick=\"lookHis('"+r[6]+"');return false;\">历史规则</a>"
		}
		function lookHis(d){
		openDialogFrame("/client/showHistroyRule_list.html?giftruleid="+d+"",'历史规则',500,700)  
		}

	     function black(){
	     	switchPage('group_all');
			$("listview").style.display="";
			    createTable();
				showData();
	     }	
		//取消跳转             
		function quxiao(){
			switchPage('group_all');
			$("listview").style.display="";
			     createTable();
				showData();
		}
		//页面跳转
		function save(){

		 	switchPage('detview');
		}

		function backOperator1(v){
			if (!v) return;
			$("guizemoban1").value = v.name;
		}

	//	function selRuleTem1(){
	//		alert("目前不考虑")
	//	 }
		//返回
		function fanhui(){
			switchPage('detviewsave1');
		}
		function quxiao8(){
			switchPage('group_all');
			$("listview").style.display="";
			     createTable();
				showData();
			Common.setValues("viewdate",{});
		}	
		function fanhui4(){
			switchPage('group_all');
			$("listview").style.display="";
			     createTable();
				showData();
			Common.setValues("viewdate",{});
		}
		//显示、刷新表格
		function showData(){
			qt.showTable();				//qt为全局的QueryTable对象  
		}
		//显示、刷新表格
		function showDataNew(){	
			qtNew.showTable();				//qt2为全局的QueryTable对象  
		}
		//显示、刷新表格
		function showData3(){	
			qt3.showTable();				//qt3为全局的QueryTable对象  
		}
		function selOperator(){
			var c = openDialogFrame("/client/sel_rule_list.html",'选择礼品',500,700)
			if (c){
			DWR.call('giftProjectService.isGiftRule',c[1],function(v){
			if(v){
			     crelistform.gift.value=c[1];
				 crelistform.giftname.value=c[2];
				 crelistform.price.value=c[4];
			}
			else{
			 showError("已经存在此礼品的规则");
			}
			});	
			}
		}
		function onSave(){
	         var  obj=document.getElementsByName("customers1");
	         var  aa; 
	      var str1="";
          for (var i=0;i <obj.length;i++) 
        { 
                var e   = obj[i]; 
            if(e.id== "customers1") 
              { 
                 if(e.checked   ==   true)   
                  {     
                       aa=obj[i].value; 
                       str1+=aa+","; 
                       } 
             } 
} 
        
           if(str1!=""){
            var str=str1.substring(0,str1.length-1)
           var beginTime = crelistform.startDate.value;
			var endTime = crelistform.endDate.value;
			var a=$('crelistform').comments.value;
			if(comptime(beginTime,endTime)!=1){
			    showInformation("规则开始日期必须小于规则结束日期!");
			    return;
			}	
			if(!checkForm(crelistform))return;
				
			     var giftRule= Common.getValues(crelistform);
			     DWR.call('giftProjectService.addGiftRule',giftRule,str,function(v){
				 showInformation("操作成功!");
				 createTableNew();
				 showDataNew();
				 switchPage('detviewsavelist');
				
			},{blockScreen:true});
			 crelistform.reset();
           }else{
            showInformation("请选择客户级别!");
           }
			
			
		}
        function comptime(beginTime,endTime){
               var beginTimes=beginTime.substring(0,10).split('-');
               var endTimes=endTime.substring(0,10).split('-');
                 beginTime=beginTimes[1]+'-'+beginTimes[2]+'-'+beginTimes[0]+' '+beginTime.substring(10,19);
                  endTime=endTimes[1]+'-'+endTimes[2]+'-'+endTimes[0]+' '+endTime.substring(10,19);
               var a =(Date.parse(endTime)-Date.parse(beginTime))/3600/1000;
            if(a<0){
                  return -1;
                 }else if (a>0){
                 return 1;
                 }else if (a==0){
                   return 0;
                  }else{
                   return 'exception'
         }
      }
        function showNewRuleList(){
               createTableNew();
			showDataNew();
			switchPage('detviewsavelist');
        }
        function send(){
        DWR.call('giftProjectService.sendGiftAM',function(v){
          if(!v){
           DWR.call('giftProjectService.isEdit',function(v){
		            if(v){
		               $("viewdate").bin.disabled=false;
		            }else{
		               $("viewdate").bin.disabled=true;
		               $("detviewsave").ee.disabled=true;
		            }
		            b=v;});
        showInformation("申请发送成功!");
       
           switchPage('group_all');
			$("listview").style.display="";
			     createTable();
				showData();
          }else{
          showInformation("审请内容不能为空");
         }
        });
       
          
        }
        function lookcheck(){
 
             switchPage('listview2');
           createTableCheck();
             
     
        }
        function createTableCheck(){
               $("checkform").orgidcheck.value=org.id;
            var columns =[];
           	columns[9]={title:"查看",width:"6%",align:"center",render:showoverlist,order:false}
            qt2 = new QueryTable("loy_check_detail_query","checkform","datalist2",columns);
            qt2.showTable();
        
        }
       function showoverlist(v,r){
      return "<a href=# onclick=\"showoverlists('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"','"+r[7]+"','"+r[8]+"','"+r[9]+"');return false;\">查看</a>"
       }
       function showoverlists(code,checktype,referer,sendTime,checkTime,atOrg,checker,varValue,comment,id){
                $("code7").innerHTML=code;
		     $("checktype7").innerHTML=checktype;
		     $("referer7").innerHTML=referer;	
		     $("sendTime7").innerHTML=sendTime;	
		      $("checkTime7").innerHTML=checkTime;	
			   $("atOrg7").innerHTML=atOrg;
		     $("checker7").innerHTML=checker;
		     $("varValue7").innerHTML=varValue;	
		      if(comment=="null") {$("comment7").innerHTML="";
                         }
                    else $("comment7").innerHTML=comment;	
		       crelistform1.act.value=id;
		       createTableList();
		       showDataList();
        switchPage('listview9');
       }
       function createTableList(){
			var columns = [];
			qtlist = new QueryTable("loy_rule_confirmlist","crelistform1","dlist",columns);				
		}		
     function showDataList(){
			qtlist.showTable();
		}
         function showData5(){
        createTableCheck();
          
       }
     function showTabAll(id, obj) {
           if(id == "listview"){
          	 $("runpaviwe").style.display="none";
          	 $("listview").style.display="";
          	  $("tab_role").className = "treeTab";
            }else{
         		 $("runpaviwe").style.display="";
         		 createTableRun();
          	 $("listview").style.display="none";
                          }
       $("tab_base").className = "treeTab";
       if (typeof obj == "string") obj = $(obj)
            obj.className = "treeTabc";
         return false;
           }
       
	
    function createTableRun(){
			var columns =[];

			qtrun = new QueryTable("loy_rule_list_byorg","runfrom","rundatalist",columns);
			qtrun.showTable();
		}
	function changeBox(){
	   if($("customers0").checked){ 
	      var  obj=document.getElementsByName("customers1");
          for (var i=0;i <obj.length;i++) 
        { 
                var e   = obj[i]; 
           
                 e.checked =true 
              
      }   
	   }else{
	      var  obj=document.getElementsByName("customers1");
	    for (var i=0;i <obj.length;i++) 
        { 
                var e   = obj[i]; 
           
                 e.checked =false 
              
           }   
	   }
	}	
	</script>
</head>
<body onload="load()">
<!--页面导航-->
<div class=" nav ">
<div id="nav">&nbsp;</div>
</div>


<div id="detviewupdate" style="display: none;" align="center">
<form id="pcardform" name="pcardform"><input
	type="hidden" id="command" name="command"> <input type="hidden"
	name="giftid" id="giftid"> <input type="hidden" name="ruleid"
	id="ruleid">
<div class="form">
<div class="formTitle">礼品规则修改</div>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
	<tr>
		<td><label>礼品名称</label> <input type=text name="giftname" readonly
			class="readonly"></td>
		<td><label>所需客户级别</label> <div id="a04div">	
         <input type="checkbox" name="customers3" value="1" id="customers3">普通卡</input>
         <input type="checkbox" name="customers3" value="2" id="customers3">银卡</input>
         <input type="checkbox" name="customers3" value="3" id="customers3">金卡</input>
         <input type="checkbox" name="customers3" value="4" id="customers3">钻石卡</input>
         <input type="checkbox" name="customers8" value="0" id="customers8" onClick="changeBox()">全部</input>
		</div></td>
	</tr>
	<tr>
		<td><label>规则开始日期</label> <input name="startDate" id="startDate"
			onblur="checkV(this,'_futureDate',true)"><img align=absMiddle
			onmouseup='showDatePicker( startDate );'
			src="../images/icon/date.gif" alt="选择日期" style="CURSOR: hand"
			border="0"></input><font color="red">&nbsp;*</font></td>
		<td><label>礼品积分</label> <input type="text" name="points"
			onblur="checkV(this,'number',true)" maxlength="10"><font
			color="red">&nbsp;*</font></td>
	</tr>
	<tr>
		<td><label>规则结束日期</label> <input type="text" name="endDate"
			id="endDate" onblur="checkV(this,'_futureDate',true)"><img
			align=absMiddle onmouseup='showDatePicker( endDate );'
			src="../images/icon/date.gif" alt="选择日期" style="CURSOR: hand"
			border="0"><font color="red">&nbsp;*</font></td>
		<td><label>备注</label> <textarea name="comments" cols="30"
			rows="3" onkeydown="textCounter(this.form.comments,this.form.remLen,32)" 
            onkeyup="textCounter(this.form.comments,this.form.remLen,32)">
            </textarea><font></font>
            <br><input type="hidden" readOnly maxLength="3" size="3" value="160" name="remLen"><br>
            </td>
	</tr>
</table>
</div>

<button type="button" onclick="onUpate()">保 存</button>
<button type="button" onclick="Cancl()">取 消</button>
</div>
</form>
<div id=detview style='display: none;' align=center>
<form id='crelistform' name='crelistform' method='POST'><input
	type=hidden id=id name=id>
<div class=form>
<div class="formTitle">礼品规则详细信息</div>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
	<tr>
		<td><label>礼品名称</label> <input type=text name="giftname" readonly
			class="readonly" onblur="checkV(this,'',true)"><a class=orga
			href=# onclick="selOperator()">&nbsp;&nbsp;</a><font color="red">&nbsp;*</font></td>
			
			<td><label>客户级别</label>
		<div id="a02div">	
         <input type="checkbox" name="customers1" value="1" id="customers1">普通卡</input>
         <input type="checkbox" name="customers1" value="2" id="customers1">银卡</input>
         <input type="checkbox" name="customers1" value="3" id="customers1">金卡</input>
         <input type="checkbox" name="customers1" value="4" id="customers1">钻石卡</input>
         <input type="checkbox" name="customers0" value="0" id="customers0" onClick="changeBox()">全部</input>
		</div>
		</td>
		
	</tr>
	<tr>
		<td><label>礼品编号</label> <input type=text name="gift" readonly
			class="readonly" onblur="checkV(this,'',true)"><font></font></td>
		<td><label>礼品单价</label> <input type=text name="price" readonly
			class="readonly" onblur="checkV(this,'',true)"><font></font></td>
	</tr>
	<tr>
		<td><label>规则开始日期</label> <input name="startDate" id="startDate"
			onblur="checkV(this,'_futureDate',true)"><img align=absMiddle
			onmouseup='showDatePicker( startDate );'
			src="../images/icon/date.gif" alt="选择日期" style="CURSOR: hand"
			border="0"></input><font color="red">&nbsp;*</font></td>
		<td><label>礼品积分</label> <input type="text" name="points"
			onblur="checkV(this,'number',true)" maxlength="10"><font
			color="red">&nbsp;*</font></td>
	</tr>
	<tr>
		<td><label>规则结束日期</label> <input type="text" name="endDate"
			id="endDate" onblur="checkV(this,'_futureDate',true)"><img
			align=absMiddle onmouseup='showDatePicker( endDate );'
			src="../images/icon/date.gif" alt="选择日期" style="CURSOR: hand"
			border="0"><font color="red">&nbsp;*</font></td>
		<td><label>备注</label> <input type="text" name="comments" cols="30"
			rows="3" maxlength="32"></input><font></font></td>
	</tr>
</table>
</div>
<button type="button" onclick="onSave()">保 存</button>
<button type="button" onclick="Cancl()">取 消</button>
</form>
</div>

<div id="detviewsavelist" style="display: none">
<form id="detviewsave" name="detviewsave"><input
	type="hidden" name="orgw" id="orgw">
<div class="listBorder" id="rule_list2">
<div class="listBar">
<div class="listTitle" align=left>规则列表</div>

</div>
<!--查询结构列表-->
<div id="datalist3"></div>
</div>
<p>
<button type="button" id=ee onclick="send()">发送审核申请</button>
<button type="button" onclick="black()">返回</button>
</p>
</form>
</div>
<div id=detviewupdate2 style='display: none;' align=center>
<form id='updateform' name='updateform' method='POST'><input
	type=hidden id=giftruleid name=giftruleid>
<div class=form>
<div class="formTitle">修改礼品规则详细信息</div>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
	<tr>
		<td><label>礼品名称</label> <input type=text name="giftname" readonly
			class="readonly"></td>
		<td><label>所需客户级别</label> <div id="a03div">	
         <input type="checkbox" name="customers2" value="1" id="customers2">普通卡</input>
         <input type="checkbox" name="customers2" value="2" id="customers2">银卡</input>
         <input type="checkbox" name="customers2" value="3" id="customers2">金卡</input>
         <input type="checkbox" name="customers2" value="4" id="customers2">钻石卡</input>
         <input type="checkbox" name="customers9" value="0" id="customers9" onClick="changeBox()">全部</input>
		</div></td>
	</tr>
	<tr>
		<td><label>规则开始日期</label> <input name="startDate" id="startDate"
			onblur="checkV(this,'_futureDate',true)"><img align=absMiddle
			onmouseup='showDatePicker( startDate );'
			src="../images/icon/date.gif" alt="选择日期" style="CURSOR: hand"
			border="0"></input><font color="red">&nbsp;*</font></td>
		<td><label>礼品积分</label> <input type="text" name="points"
			onblur="checkV(this,'number',true)" maxlength="10"><font
			color="red">&nbsp;*</font></td>
	</tr>
	<tr>
		<td><label>规则结束日期</label> <input type="text" name="endDate"
			id="endDate" onblur="checkV(this,'',true)"><img
			align=absMiddle onmouseup='showDatePicker( endDate );'
			src="../images/icon/date.gif" alt="选择日期" style="CURSOR: hand"
			border="0"><font color="red">&nbsp;*</font></td>
		<td><label>备注</label> <textarea name="comments" cols="30"
			rows="3" onkeydown="textCounter(this.form.comments,this.form.remLen,32)" 
            onkeyup="textCounter(this.form.comments,this.form.remLen,32)">
            </textarea><font></font>
            <br><input type="hidden" readOnly maxLength="3" size="3" value="160" name="remLen"><br>
            </td>
	</tr>
</table>
</div>
<button type="button" onclick="onUpdateMo()">保 存</button>
<button type="button" onclick="Cancl()">取 消</button>
</form>
</div>

<div id=listview2 style='display: none;' align=center>
<div class="formTitle">审核记录</div>
<div class="form">
<form id='checkform' name='checkform'><input type=hidden id=orgidcheck
	name=orgidcheck>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
	<tr>
	   <td><label>申请时间</label> <input type=text name="sendDate" onblur="checkV(this,'date')"><a href="javascript:void(0)" onclick='showDatePicker( $("sendDate"));' class="date" title="选择日期">&nbsp;&nbsp;</a></td>
		
		<td><label>提交人</label> <input type=text name="referer"
			id="referer"></td>
		<td><label>变更单编号</label> <input type=text name="code" id="code"></td>

		<td>
		<button type="button" onclick="showData5()">查 询</button>
		<button type="button" onclick="Cancl()">返 回</button>
		</td>
	</tr>
	<tr>
	<td><label>审核时间</label> <input type=text name="checkDate" onblur="checkV(this,'date')"><a href="javascript:void(0)" onclick='showDatePicker( $("checkDate"));' class="date" title="选择日期">&nbsp;&nbsp;</a></td>
		
		<td><label>审核人</label> <input type=text name="checker"
			id="checker"></td>
		<td></td>

	</tr>
</table>
</form>
</div>
<div id=datalist2></div>
</div>




<div id=listview9 style='display: none;' align=center>
<form id='crelistform1' name='crelistform1' method='POST'
	enctype='multipart/form-data' action='/upload/pic/'>
<div class=form>
<div class="formTitle">规则信息</div>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
<td>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
	<input type="hidden" name="act"
	id="act">
	<tr>
	    <td><label>变更单编号</label> <span id="code7"></span></td>
		<td><label>申请日期</label> <span id="sendTime7"></span></td>

	</tr>
	<tr>
	    <td><label>审核类型</label> <span id="checktype7"></span></td>
		<td><label>审核日期</label> <span id="checkTime7"></span></td>
		
	</tr>
	<tr>
		<td><label>审核机构</label> <span id="atOrg7"></span></td>
		<td><label>审核结果</label> <span id="varValue7"></span></td>
		
	<tr>
	<td><label>提交人</label> <span id="referer7"></span></td>
	<td><label>审核人</label> <span id="checker7"></span></td>
	</tr>
</table>
</td>
<td>
<table cellSpacing=0 cellPadding=4 width="100%" border=0
	class="col3 label6">
	<td><label>反馈意见</label> <textarea  readonly  name="comment7" cols="30"
			rows="4"></textarea><font></font></td>	
	</tr>
</table>
</td>
</table>
</div>
<div id="dlist"></div>
</form>


<button type="button" onclick="Cancl2()">返回</button>
</div>
</div>
<div id='group_all' align="left">
<div class="formTitle">礼品规则管理</div>
<a href='#' onclick="showTabAll('listview',this);" onfocus="this.blur()" tabindex="-1" id="tab_base" class="treeTabc">本地礼品规则</a>
 <a href='#' onclick="showTabAll('runpaviwe',this);" onfocus="this.blur()" tabindex="-1" id="tab_role" class="treeTab">正运行的礼品规则</a>

</div>
<div id="runpaviwe"  style='display: none;'>
<form name="runfrom" id="runfrom"><input
	type="hidden" id="orgid" name="orgid"/></form>
	
<div id=rundatalist></div>
</div>
<div id=listview style="display: none;">
<div class="form">
<form name="viewdate" id="viewdate">
<div class="searchForm">
<input type="hidden" name="orgw" id="orgw">
<table cellSpacing="0" cellPadding="4" width="100%" border="0"
	class="col2 label6">
	<tr>
		<td><label>礼品名称</label> <input type="text" name="giftName"
			id="giftName" value=""></td>
	</tr>
	<tr>
		<td>
		<button type="button" onclick="showData()">查 询</button>
		</td>
		<td>
		<button type="button" onclick="lookcheck()">查询审核记录</button>
		<button type="button" id=bin onclick="save()">新建礼品规则</button>
		<button type="button" onclick="showNewRuleList()">查看未审核礼品规则</button>
		</td>
	</tr>
</table>
</div>
</form>
</div>
<div id=datalist></div>
</div>
</body>
</html>